package opreation.impl;

import book.Book;
import book.BookList;
import opreation.IOperation;

//归还书籍
public class ReturnOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.print("请输入您想要归还的书籍：");
        String name = scanner.next();
        if(bookList.contains(name)){
            Book book = bookList.findBook(name);
            if(!book.isBorrowed()){
                System.out.println("该书未被借走，无须还书！");
            }else{
                System.out.println("还书成功");
                book.setBorrowed(false);
            }
        }else{
            System.out.println("没有找到您想要的书籍！");
        }
    }
}
